import type { App } from 'vue'
import { Button } from './Button'
import SearchGroup from './SearchGroup/index.vue'
import {
  // Need
  Button as AntButton,
  Input,
  Layout,
  Tabs,
  TabPane,
  Select,
  Tree,
  Table,
  Progress,
  Pagination,
  Row,
  Col,
  Slider,
  Collapse,
  CollapsePanel,
  Modal,
  Radio,
  RadioGroup,
  // RadioButton,
  Checkbox,
  Card,
  Form,
  FormItem,
  Space,
  Dropdown,
  Menu,
  Switch,
  List,
  Image,
  ListItem,
  DatePicker,
  Popconfirm,
  Transfer,
  Tag,
  InputNumber,
  Upload,
  Spin,
  Tooltip,
  CheckboxGroup,
  TimePicker,
  Statistic,
} from 'ant-design-vue'

Modal.props.maskClosable.default = false
// Table.setup?.apply // ???

const compList = [
  Spin,
  InputNumber,
  Tag,
  AntButton.Group,
  Tabs,
  TabPane,
  Select,
  Tree,
  Table,
  Progress,
  Pagination,
  Row,
  Col,
  Collapse,
  Card,
  Slider,
  CollapsePanel,
  Modal,
  Radio,
  RadioGroup,
  Checkbox,
  Form,
  FormItem,
  Space,
  Dropdown,
  Menu,
  Menu.Item,
  Switch,
  Image,
  List,
  ListItem,
  Popconfirm,
  DatePicker,
  Transfer,
  Radio.Button,
  Upload,
  // RadioButton
  Tooltip,
  SearchGroup,
  CheckboxGroup,
  TimePicker,
  DatePicker.RangePicker,
  Statistic.Countdown,
]

export function registerGlobComp(app: App) {
  compList.forEach(comp => {
    app.component(comp.name || comp.displayName, comp)
  })

  app.use(Input).use(Button).use(Layout)
}
